package com.ming.mapper;


import com.ming.pojo.AccessRecord;
import lombok.Data;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.math.BigDecimal;
import java.sql.Timestamp;
import java.util.Date;
import java.util.List;

@Mapper
public interface AccessRecordMapper {

    /**
     * 插入一条“车辆进入”信息
     * @param carLicenseId
     * @param enterTime
     * @param isInterior
     */
    void addEnterRecord(@Param("carLicenseId") String carLicenseId,@Param("enterTime") String enterTime, @Param("isInterior") Boolean isInterior);

    /**
     * 插入一条“车辆离开”信息
     * 即更新补全“出入记录”
     * @param carLicenseId
     * @param leaveTime
     * @param expense
     */
    void addLeaveRecord(@Param("carLicenseId") String carLicenseId, @Param("leaveTime") String leaveTime, @Param("expense") BigDecimal expense);

    /**
     *根据车牌查询进入时间
     * @param carLicenseId
     * @return
     */
    Date queryEnterByCarId(String carLicenseId);

    /**
     * 查询所有车辆出入记录
     * @return
     */
    List<AccessRecord> queryAllRecord();

    /**
     * 通过车牌查询车辆出入记录
     * @param carLicenseId
     * @return
     */
    List<AccessRecord> queryRecordByCarId(String carLicenseId);

    /**
     * 通过车辆类型查询车辆
     * @param isInterior
     * @return
     */
    List<AccessRecord> queryRecordByIs(boolean isInterior);

    /**
     * 添加出入记录
     * @param accessRecord
     */
    void addRecord(AccessRecord accessRecord);

    /**
     * 删除出入记录
     * @param carLicense
     * @param enterTime
     */
    void deleteRecord(@Param("carLicense") String carLicense, @Param("enterTime") String enterTime);

}
